local xinyuetuji = fk.CreateSkill {
  name = "df__xinyuetuji",
}

Fk:loadTranslationTable{
  ["df__xinyuetuji"] = "新月突击",
  [":df__xinyuetuji"] = "若你的手牌数等于手牌上限，你可以将一张红色基本牌当【无中生有】或【决斗】使用，或将一张黑色牌当基本牌使用或打出。",

  ["$df__xinyuetuji1"] = "",
  ["$df__xinyuetuji2"] = "",
}

xinyuetuji:addEffect("viewas", {
  anim_type = "offensive",
  prompt = "将一张红色基本牌当【无中生有】或【决斗】使用；将一张黑色牌当基本牌使用或打出",
  interaction = function(self, player)
    return UI.CardNameBox {choices = {"slash","jink","peach","analeptic", "ex_nihilo","duel"}}
  end,
  handly_pile = true,
  card_filter = function (self, player, to_select, selected)
    if #selected == 0 then
      if self.interaction.data == "ex_nihilo" or self.interaction.data == "duel" then
        return Fk:getCardById(to_select).color == Card.Red and Fk:getCardById(to_select).type == Card.TypeBasic
      elseif self.interaction.data == "slash" or self.interaction.data == "jink" or self.interaction.data == "peach" or self.interaction.data == "analeptic" then
        return Fk:getCardById(to_select).color == Card.Black
      end
    end
  end,
  view_as = function (self, player, cards)
    if #cards ~= 1 or not self.interaction.data then return end
    local card = Fk:cloneCard(self.interaction.data)
    card:addSubcard(cards[1])
    card.skillName = xinyuetuji.name
    return card
  end,
  enabled_at_play = function(self, player)
    return player:getHandcardNum() == player:getMaxCards()
  end,
  enabled_at_response = function(self, player, response)
    return player:getHandcardNum() == player:getMaxCards()
  end,
})

return xinyuetuji
